﻿Imports System.Data.OleDb

Public Class DataProvider
    Private conn As New OleDbConnection
    Private Shared _conecstring As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=QLKS.mdb"
    Public Shared Function ConnectDB() As OleDbConnection
        Dim conn As OleDbConnection
        conn = New OleDbConnection(_conecstring)
        Return conn
    End Function


    
    Public Function TryVan(ByVal CauLenh As String) As DataTable
        Dim conn As OleDbConnection = DataProvider.ConnectDB()

        Dim da As New OleDbDataAdapter(CauLenh, conn)
        Dim dt As New DataTable
        Try
            conn.Open()
            da.Fill(dt)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Exclamation)
        End Try
        conn.Close()
        Return dt
    End Function

End Class
